package com.example.redisLock.config;

import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lxf
 * @description
 * @date 2021/3/9 0:37
 */
@Configuration
public class RedissonConfig {

    @Value("${spring.redis.password}")
    private String password;

    @Bean
    public Redisson redisson(){
        Config config = new Config();
        config.useSingleServer().setAddress("redis://118.25.131.121:6379").setPassword(password).setDatabase(0);
        return (Redisson) Redisson.create(config);
    }
}
